Second step toward a new network infrastructure, move XmConsole to be
authoremellor@leeni.uk.xensource.com <emellor@leeni.uk.xensource.com>
Thu, 4 May 2006 13:22:17 +0000 (14:22 +0100)
committeremellor@leeni.uk.xensource.com <emellor@leeni.uk.xensource.com>
Thu, 4 May 2006 13:22:17 +0000 (14:22 +0100)
in XenDomain. The devices we will add, like network, will need to run
console commands when a domain is started. So I have made console be
a part of domain object, which it's tied to anyway.

Signed-off-by: Daniel Stekloff <dsteklof@us.ibm.com>
79 files changed:
tools/xm-test/lib/XmTestLib/Console.py
tools/xm-test/lib/XmTestLib/Test.py
tools/xm-test/lib/XmTestLib/XenDomain.py
tools/xm-test/tests/_sanity/01_domu_proc.py
tools/xm-test/tests/block-create/01_block_attach_device_pos.py
tools/xm-test/tests/block-create/02_block_attach_file_device_pos.py
tools/xm-test/tests/block-create/04_block_attach_device_repeatedly_pos.py
tools/xm-test/tests/block-create/05_block_attach_and_dettach_device_repeatedly_pos.py
tools/xm-test/tests/block-create/07_block_attach_baddevice_neg.py
tools/xm-test/tests/block-create/08_block_attach_bad_filedevice_neg.py
tools/xm-test/tests/block-create/09_block_attach_and_dettach_device_check_data_pos.py
tools/xm-test/tests/block-create/10_block_attach_dettach_multiple_devices.py
tools/xm-test/tests/block-destroy/01_block-destroy_btblock_pos.py
tools/xm-test/tests/block-destroy/02_block-destroy_rtblock_pos.py
tools/xm-test/tests/block-destroy/04_block-destroy_nonattached_neg.py
tools/xm-test/tests/block-destroy/05_block-destroy_byname_pos.py
tools/xm-test/tests/block-list/01_block-list_pos.py
tools/xm-test/tests/block-list/02_block-list_attachbd_pos.py
tools/xm-test/tests/block-list/03_block-list_anotherbd_pos.py
tools/xm-test/tests/block-list/04_block-list_nodb_pos.py
tools/xm-test/tests/block-list/06_block-list_checkremove_pos.py
tools/xm-test/tests/create/01_create_basic_pos.py
tools/xm-test/tests/create/04_create_conflictname_neg.py
tools/xm-test/tests/create/06_create_mem_neg.py
tools/xm-test/tests/create/07_create_mem64_pos.py
tools/xm-test/tests/create/08_create_mem128_pos.py
tools/xm-test/tests/create/09_create_mem256_pos.py
tools/xm-test/tests/create/10_create_fastdestroy.py
tools/xm-test/tests/create/11_create_concurrent_pos.py
tools/xm-test/tests/create/12_create_concurrent_stress_pos.py
tools/xm-test/tests/create/13_create_multinic_pos.py
tools/xm-test/tests/create/14_create_blockroot_pos.py
tools/xm-test/tests/create/15_create_smallmem_pos.py
tools/xm-test/tests/create/16_create_smallmem_neg.py
tools/xm-test/tests/destroy/01_destroy_basic_pos.py
tools/xm-test/tests/destroy/05_destroy_byid_pos.py
tools/xm-test/tests/destroy/07_destroy_stale_pos.py
tools/xm-test/tests/list/04_list_goodparm_pos.py
tools/xm-test/tests/memset/01_memset_basic_pos.py
tools/xm-test/tests/memset/03_memset_random_pos.py
tools/xm-test/tests/memset/04_memset_smallmem_pos.py
tools/xm-test/tests/migrate/01_migrate_localhost_pos.py
tools/xm-test/tests/network-attach/01_network_attach_pos.py
tools/xm-test/tests/network-attach/02_network_attach_detach_pos.py
tools/xm-test/tests/network-attach/03_network_attach_detach_multiple_pos.py
tools/xm-test/tests/network/02_network_local_ping_pos.py
tools/xm-test/tests/network/03_network_local_tcp_pos.py
tools/xm-test/tests/network/04_network_local_udp_pos.py
tools/xm-test/tests/network/05_network_dom0_ping_pos.py
tools/xm-test/tests/network/06_network_dom0_tcp_pos.py
tools/xm-test/tests/network/07_network_dom0_udp_pos.py
tools/xm-test/tests/network/11_network_domU_ping_pos.py
tools/xm-test/tests/network/12_network_domU_tcp_pos.py
tools/xm-test/tests/network/13_network_domU_udp_pos.py
tools/xm-test/tests/pause/01_pause_basic_pos.py
tools/xm-test/tests/pause/02_pause_badopt_neg.py
tools/xm-test/tests/reboot/01_reboot_basic_pos.py
tools/xm-test/tests/reboot/02_reboot_badopt_neg.py
tools/xm-test/tests/restore/01_restore_basic_pos.py
tools/xm-test/tests/restore/04_restore_withdevices_pos.py
tools/xm-test/tests/save/01_save_basic_pos.py
tools/xm-test/tests/save/03_save_bogusfile_neg.py
tools/xm-test/tests/sedf/01_sedf_period_slice_pos.py
tools/xm-test/tests/sedf/02_sedf_period_lower_neg.py
tools/xm-test/tests/sedf/03_sedf_slice_lower_neg.py
tools/xm-test/tests/sedf/04_sedf_slice_upper_neg.py
tools/xm-test/tests/sedf/05_sedf_extratime_pos.py
tools/xm-test/tests/sedf/06_sedf_extratime_disable_neg.py
tools/xm-test/tests/shutdown/01_shutdown_basic_pos.py
tools/xm-test/tests/shutdown/02_shutdown_badparm_neg.py
tools/xm-test/tests/sysrq/02_sysrq_sync_pos.py
tools/xm-test/tests/sysrq/03_sysrq_withreboot_pos.py
tools/xm-test/tests/unpause/01_unpause_basic_pos.py
tools/xm-test/tests/vcpu-disable/01_vcpu-disable_basic_pos.py
tools/xm-test/tests/vcpu-pin/01_vcpu-pin_basic_pos.py
tools/xm-test/tests/vtpm/01_vtpm-list_pos.py
tools/xm-test/tests/vtpm/02_vtpm-cat_pcrs.py
tools/xm-test/tests/vtpm/03_vtpm-susp_res.py
tools/xm-test/tests/vtpm/04_vtpm-loc_migr.py

index 695106be606791631a07cbf382de55336a0c67b9..7a6a74548c943143ab086b0ebdc39cc165bad054 100755 (executable)
@@ -234,11 +234,14 @@ class XmConsole:
             "return": 0,
             }
 
-    def closeConsole(self):
+    def __closeConsole(self):
         """Closes the console connection and ensures that the console
-        process is killed"""
-        os.close(self.consoleFd)
-        os.kill(self.consolePid, 2)
+        process is killed. This should only be called by the domain.
+        Tests should call domain.closeConsole()"""
+        if self.consolePid != 0:
+            os.close(self.consoleFd)
+            os.kill(self.consolePid, 2)
+            self.consolePid = 0
 
 
     def setLimit(self, limit):
@@ -249,6 +252,10 @@ class XmConsole:
             self.limit = int(limit)
         except Exception, e:
             self.limit = None
+    def setHistorySaveCmds(self, value):
+        # True or False
+        self.historySaveCmds = value
             
                    
 if __name__ == "__main__":
@@ -272,7 +279,7 @@ if __name__ == "__main__":
         print "Console failed (%)" % str(e)
         sys.exit(255)
         
-    t.closeConsole()
+    t._XmConsole__closeConsole()
     
     print run["output"],
     sys.exit(run["return"])
index ee49ccd35830d9ac9a1cbee54d409a45004853e6..68a176c27373582ba90deea5d64d2f98284748e7 100644 (file)
@@ -173,8 +173,7 @@ def isConsoleDead():
     domain = XmTestDomain()
 
     try:
-        domain.start()
-        console = XmConsole(domain.getName())
+        console = domain.start()
         console.runCmd("ls")
     except DomainError, e:
         return True
index d13037f0fef12a14db464e490164f43fdefa25a8..e9cd1e5326c627567f771336f4cff77ca18350c0 100644 (file)
@@ -27,6 +27,7 @@ import time
 from Xm import *
 from Test import *
 from config import *
+from Console import *
 
 BLOCK_ROOT_DEV = "hda"
 
@@ -193,6 +194,8 @@ class XenDomain:
             self.name = getUniqueName()
 
         self.config = config
+        self.console = None
+
         # Set domain type, either PV for ParaVirt domU or HVM for 
         # FullVirt domain
         if ENABLE_HVM_SUPPORT:
@@ -200,7 +203,7 @@ class XenDomain:
         else:
             self.type = "PV"
 
-    def start(self):
+    def start(self, noConsole=False):
 
         ret, output = traceCommand("xm create %s" % self.config)
 
@@ -213,10 +216,22 @@ class XenDomain:
         if self.getDomainType() == "HVM":
             waitForBoot()
 
+        if self.console and noConsole == True:
+            self.closeConsole()
+
+        elif self.console and noConsole == False:
+            return self.console
+
+        elif not self.console and noConsole == False:
+            return self.getConsole()
+
     def stop(self):
         prog = "xm"
         cmd = " shutdown "
 
+        if self.console:
+            self.closeConsole()
+
         ret, output = traceCommand(prog + cmd + self.config.getOpt("name"))
 
         return ret
@@ -225,6 +240,9 @@ class XenDomain:
         prog = "xm"
         cmd = " destroy "
 
+        if self.console:
+            self.closeConsole()
+
         ret, output = traceCommand(prog + cmd + self.config.getOpt("name"))
 
         return ret
@@ -238,6 +256,24 @@ class XenDomain:
     def getDomainType(self):
         return self.type
 
+    def closeConsole(self):
+        # The domain closeConsole command must be called by tests, not the
+        # console's close command. Once close is called, the console is
+        # gone. You can't get history or anything else from it.
+        if self.console:
+            self.console._XmConsole__closeConsole()
+            self.console = None
+
+    def getConsole(self):
+        if self.console:
+            self.closeConsole()
+
+        self.console = XmConsole(self.getName())
+        # Activate the console
+        self.console.sendInput("input")
+
+        return self.console
+
 
 class XmTestDomain(XenDomain):
 
index 56eb391bed8124541cfe404cbe3f9e653bb433da..f283ae6b93399b69d31d5884104b5c89279f5ec8 100644 (file)
@@ -15,13 +15,11 @@ import re
 domain = XmTestDomain()
 
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     FAIL(str(e))
 
 try:
-    console = XmConsole(domain.getName())
-    console.sendInput("foo")
     run = console.runCmd("cat /proc/cpuinfo")
 except ConsoleError, e:
     FAIL(str(e))
index 564ffad0bf675a53cd6d8a83efb695fbd10898f8..492d83f2cfc942e3663b580d736aa5539d65c5f9 100644 (file)
@@ -16,7 +16,7 @@ if ENABLE_HVM_SUPPORT:
 domain = XmTestDomain()
 
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
@@ -25,13 +25,7 @@ except DomainError, e:
 
 # Attach a console to it
 try:
-    console = XmConsole(domain.getName(), historySaveCmds=True)
-except ConsoleError, e:
-    FAIL(str(e))
-
-try:
-    # Activate the console
-    console.sendInput("input")
+    console.setHistorySaveCmds(value=True)
     # Run 'ls'
     run = console.runCmd("ls")
 except ConsoleError, e:
@@ -49,7 +43,7 @@ except ConsoleError, e:
        FAIL(str(e))
 
 # Close the console
-console.closeConsole()
+domain.closeConsole()
 
 # Stop the domain (nice shutdown)
 domain.stop()
index 0cfb6de1099a26047e8ddd388e4d0cc9ee23eaaf..df3f0d67a619ced320e9edbce28dd6f7b787e11c 100644 (file)
@@ -16,22 +16,16 @@ if ENABLE_HVM_SUPPORT:
 domain = XmTestDomain()
 
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
         print e.extra
     FAIL(str(e))
 
-# Attach a console to it
+# Set console to save commands and make sure we can run cmds
 try:
-    console = XmConsole(domain.getName(), historySaveCmds=True)
-except ConsoleError, e:
-    FAIL(str(e))
-
-try:
-    # Activate the console
-    console.sendInput("input")
+    console.setHistorySaveCmds(value=True)
     # Run 'ls'
     run = console.runCmd("ls")
 except ConsoleError, e:
@@ -49,7 +43,7 @@ except ConsoleError, e:
         FAIL(str(e))
 
 # Close the console
-console.closeConsole()
+domain.closeConsole()
 
 # Stop the domain (nice shutdown)
 domain.stop()
index 8a5680f10b1de32342c547a8e192197836676045..a3b9785785d91b31ee4bdf6d202f4d7bc05358a9 100644 (file)
@@ -16,22 +16,15 @@ if ENABLE_HVM_SUPPORT:
 domain = XmTestDomain()
 
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
         print e.extra
     FAIL(str(e))
 
-# Attach a console to it
 try:
-    console = XmConsole(domain.getName(), historySaveCmds=True)
-except ConsoleError, e:
-    FAIL(str(e))
-
-try:
-    # Activate the console
-    console.sendInput("input")
+    console.setHistorySaveCmds(value=True)
     # Run 'ls'
     run = console.runCmd("ls")
 except ConsoleError, e:
@@ -49,7 +42,7 @@ for i in range(10):
             FAIL("Device is not actually attached to domU")
 
 # Close the console
-console.closeConsole()
+domain.closeConsole()
 
 # Stop the domain (nice shutdown)
 domain.stop()
index 1434ad21764f2d3a4d62b66894236842d63a3585..7f7fe77ead55ad7da0557c81c2b51c55f69b845b 100644 (file)
@@ -16,22 +16,15 @@ if ENABLE_HVM_SUPPORT:
 domain = XmTestDomain()
 
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
         print e.extra
     FAIL(str(e))
 
-# Attach a console to it
 try:
-    console = XmConsole(domain.getName(), historySaveCmds=True)
-except ConsoleError, e:
-    FAIL(str(e))
-
-try:
-    # Activate the console
-    console.sendInput("input")
+    console.setHistorySaveCmds(value=True)
     # Run 'ls'
     run = console.runCmd("ls")
 except ConsoleError, e:
@@ -57,7 +50,7 @@ for i in range(10):
                FAIL("Failed to dettach block device: /proc/partitions still showing that!")
 
 # Close the console
-console.closeConsole()
+domain.closeConsole()
 
 # Stop the domain (nice shutdown)
 domain.stop()
index ac179d50a3be16668ecd702e89318fefb26696cc..2c6b19e54aec05845cc96470b4f1f3606bc01c0f 100644 (file)
@@ -16,22 +16,15 @@ if ENABLE_HVM_SUPPORT:
 domain = XmTestDomain()
 
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
         print e.extra
     FAIL(str(e))
 
-# Attach a console to it
 try:
-    console = XmConsole(domain.getName(), historySaveCmds=True)
-except ConsoleError, e:
-    FAIL(str(e))
-
-try:
-    # Activate the console
-    console.sendInput("input")
+    console.setHistorySaveCmds(value=True)
     # Run 'ls'
     run = console.runCmd("ls")
 except ConsoleError, e:
@@ -53,7 +46,7 @@ except ConsoleError, e:
        FAIL(str(e))
 
 # Close the console
-console.closeConsole()
+domain.closeConsole()
 
 # Stop the domain (nice shutdown)
 domain.stop()
index 2a908c3295557c7670be2bc2e88d26b8acc4412b..8c129bd2a349cbc78d1bafd43fe750f587580af4 100644 (file)
@@ -16,22 +16,15 @@ if ENABLE_HVM_SUPPORT:
 domain = XmTestDomain()
 
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
         print e.extra
     FAIL(str(e))
 
-# Attach a console to it
 try:
-    console = XmConsole(domain.getName(), historySaveCmds=True)
-except ConsoleError, e:
-    FAIL(str(e))
-
-try:
-    # Activate the console
-    console.sendInput("input")
+    console.setHistorySaveCmds(value=True)
     # Run 'ls'
     run = console.runCmd("ls")
 except ConsoleError, e:
@@ -52,7 +45,7 @@ except ConsoleError, e:
        FAIL(str(e))
 
 # Close the console
-console.closeConsole()
+domain.closeConsole()
 
 # Stop the domain (nice shutdown)
 domain.stop()
index 4bcfd863f307d81e2abcd1ff42848c7395c445e0..bcfb4fe26c7b3ef9420c547dbe1d408b9cc90d3b 100644 (file)
@@ -16,22 +16,15 @@ if ENABLE_HVM_SUPPORT:
 domain = XmTestDomain()
 
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
         print e.extra
     FAIL(str(e))
 
-# Attach a console to it
 try:
-    console = XmConsole(domain.getName(), historySaveCmds=True)
-except ConsoleError, e:
-    FAIL(str(e))
-
-try:
-    # Activate the console
-    console.sendInput("input")
+    console.setHistorySaveCmds(value=True)
     # Run 'ls'
     run = console.runCmd("ls")
 except ConsoleError, e:
@@ -72,7 +65,7 @@ for i in range(10):
                FAIL("Failed to dettach block device: /proc/partitions still showing that!")
 
 # Close the console
-console.closeConsole()
+domain.closeConsole()
 
 # Stop the domain (nice shutdown)
 domain.stop()
index 4c3b4d18514906a17e395200d448fc73602e285b..b538e3d93641ea9cd8d117a020fe3a5454bc48cf 100644 (file)
@@ -53,22 +53,15 @@ if ENABLE_HVM_SUPPORT:
 domain = XmTestDomain()
 
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
         print e.extra
     FAIL(str(e))
 
-# Attach a console to it
 try:
-    console = XmConsole(domain.getName(), historySaveCmds=True)
-except ConsoleError, e:
-    FAIL(str(e))
-
-try:
-    # Activate the console
-    console.sendInput("input")
+    console.setHistorySaveCmds(value=True)
     # Run 'ls'
     run = console.runCmd("ls")
 except ConsoleError, e:
@@ -103,7 +96,7 @@ while i < ramdisks or devices:
            FAIL(msg)
 
 # Close the console
-console.closeConsole()
+domain.closeConsole()
 
 # Stop the domain (nice shutdown)
 domain.stop()
index e3f76c198511dba216b5d9320dce19b089cace53..1e465b3c3729443d0e07b10bee344a2eaa89d287 100644 (file)
@@ -12,15 +12,14 @@ config = {"disk":"phy:/dev/ram0,hda1,w"}
 domain = XmTestDomain(extraConfig=config)
 
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print e.extra
     FAIL("Unable to create domain")
 
 try:
-    console  = XmConsole(domain.getName(), historySaveCmds=True)
-    console.sendInput("input")
+    console.setHistorySaveCmds(value=True)
     run = console.runCmd("cat /proc/partitions | grep hda1")
     run2 = console.runCmd("cat /proc/partitions")
 except ConsoleError, e:
@@ -41,7 +40,7 @@ except ConsoleError, e:
     saveLog(console.getHistory())
     FAIL(str(e))
 
-console.closeConsole()
+domain.closeConsole()
 domain.stop()
 
 if run["return"] == 0:
index db918b7634cf6797cf6f3384febc39bccc15f4af..4055c7d887fa1d476fa1b8e39e99489c8937311d 100644 (file)
@@ -11,7 +11,7 @@ if ENABLE_HVM_SUPPORT:
 domain = XmTestDomain()
 
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print e.extra
@@ -23,12 +23,6 @@ if status != 0:
     pass
 
 try:
-    console = XmConsole(domain.getName())
-except ConsoleError, e:
-    FAIL(str(e))
-
-try:
-    console.sendInput("input")
     run = console.runCmd("cat /proc/partitions | grep hda1")
 except ConsoleError, e:
     saveLog(console.getHistory())
@@ -47,7 +41,7 @@ except ConsoleError, e:
     saveLog(console.getHistory())
     FAIL(str(e))
 
+domain.stop()
+
 if run["return"] == 0:
     FAIL("block-detach failed to detach block device")
-    
-    
index 6fea02864fae4b1d268106c9e0986ea0ade3b7f2..eea20277716d9a35d9acbaf56652d37f3a5d4fa1 100644 (file)
@@ -13,7 +13,7 @@ if ENABLE_HVM_SUPPORT:
 domain = XmTestDomain()
                                                                                                        
 try:
-    domain.start()
+    domain.start(noConsole=True)
 except DomainError, e:
     if verbose:
         print e.extra
index 5e2587e35fe66347bde785a4fa70fff67c1f3ed0..3f43fe9d95337b36b94c58965406ab064f6b3244 100644 (file)
@@ -12,15 +12,13 @@ config = {"disk":"phy:/dev/ram0,hda1,w"}
 domain = XmTestDomain(extraConfig=config)
 
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print e.extra
     FAIL("Unable to create domain")
 
 try:
-    console  = XmConsole(domain.getName(), historySaveCmds=True)
-    console.sendInput("input")
     run = console.runCmd("cat /proc/partitions | grep hda1")
     run2 = console.runCmd("cat /proc/partitions")
 except ConsoleError, e:
@@ -41,7 +39,7 @@ except ConsoleError, e:
     saveLog(console.getHistory())
     FAIL(str(e))
 
-console.closeConsole()
+domain.closeConsole()
 domain.stop()
 
 if run["return"] == 0:
index d176be82f7848b9bdeb2c1c49144e084298ee441..05df76c1899f2aa933f943cb847eb66094878b7c 100644 (file)
@@ -15,7 +15,7 @@ config = {"disk":"phy:/dev/ram0,hda1,w"}
 domain = XmTestDomain(extraConfig=config)
 
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print e.extra
@@ -31,16 +31,12 @@ elif where < 0:
 
 #Verify the block device on DomainU
 try:
-    console = XmConsole(domain.getName())
-except ConsoleError, e:
-    FAIL(str(e))
-
-try:
-    console.sendInput("input")
     run = console.runCmd("cat /proc/partitions | grep hda1")
 except ConsoleError, e:
     saveLog(console.getHistory())
     FAIL(str(e))
 
+domain.stop()
+
 if run["return"] != 0:
     FAIL("Failed to verify that block dev is attached on DomainU")
index 8a8459938e6804c2734da2478787a8c343695f54..c189dbe335329187a6cd2f6374300b5b6d9f3720 100644 (file)
@@ -14,7 +14,7 @@ if ENABLE_HVM_SUPPORT:
 domain = XmTestDomain()
                                                                                               
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print e.extra
@@ -36,16 +36,12 @@ elif where < 0 :
 
 #Verify attached block device on DomainU
 try:
-    console = XmConsole(domain.getName())
-except ConsoleError, e:
-    FAIL(str(e))
-
-try:
-    console.sendInput("input")
     run = console.runCmd("cat /proc/partitions | grep hda1")
 except ConsoleError, e:
     saveLog(console.getHistory())
     FAIL(str(e))
 
+domain.stop()
+
 if run["return"] != 0:
     FAIL("Failed to verify that block dev is attached on DomainU")
index 26e42097a481a3eea14ec433219592887ca7fc5a..1556b065ef9a1d452687af2b03c7854000318ee3 100644 (file)
@@ -15,7 +15,7 @@ config = {"disk":"phy:/dev/ram0,hda1,w"}
 domain = XmTestDomain(extraConfig=config)
 
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print e.extra
@@ -43,16 +43,12 @@ elif (where1 < 0) and (where2 < 0):
 
 #Verify attached block device on DomainU
 try:
-    console = XmConsole(domain.getName())
-except ConsoleError, e:
-    FAIL(str(e))
-
-try:
-    console.sendInput("input")
     run = console.runCmd("cat /proc/partitions | grep hda1;cat /proc/partitions | grep hda2")
 except ConsoleError, e:
     saveLog(console.getHistory())
     FAIL(str(e))
 
+domain.stop()
+
 if run["return"] != 0:
     FAIL("Failed to verify that block dev is attached on DomainU")
index ae5e4f51ac64be4e189c548845c8cf4103745971..131eee712dda3865a0eeb16bfaa5374b59a251f4 100644 (file)
@@ -14,7 +14,7 @@ if ENABLE_HVM_SUPPORT:
 domain = XmTestDomain()
 
 try:
-    domain.start()
+    domain.start(noConsole=True)
 except DomainError, e:
     if verbose:
         print e.extra
index ccdbe5c816f157dbaa6a5563a53caae760627bf3..5cba6f49b50d07a96b5e643ae9fb564ab0fc922f 100644 (file)
@@ -11,15 +11,10 @@ if ENABLE_HVM_SUPPORT:
 domain = XmTestDomain()
 
 try:
-    domain.start()
+    domain.start(noConsole=True)
 except DomainError, e:
     FAIL(str(e))
 
-try:
-    console = XmConsole(domain.getName())
-except ConsoleError, e:
-    FAIL(str(e))
-
 s, o = traceCommand("xm block-list %s" % domain.getName())
 if s != 0:
     FAIL("block-list returned !0 when no devices attached")
@@ -72,4 +67,4 @@ if o.find("770") != -1:
 if o:
     FAIL("block-list still shows something after all devices detached!")
     
-
+domain.stop()
index 7a45df2de4fe370cedc75972f1666d330f8173a5..20bf533b363ce780789ff9879aee5c8728a80203 100644 (file)
@@ -18,37 +18,29 @@ if int(getInfo("free_memory")) < domain.config.getOpt("memory"):
 
 # Start it
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
         print e.extra
     FAIL(str(e))
 
-# Attach a console to it
 try:
-    console = XmConsole(domain.getName(), historySaveCmds=True)
-except ConsoleError, e:
-    FAIL(str(e))
-
-try:
-    # Activate the console
-    console.sendInput("input")
     # Run 'ls'
     run = console.runCmd("ls")
 except ConsoleError, e:
     saveLog(console.getHistory())
     FAIL(str(e))
+
+# Save a transcript for human review
+saveLog(console.getHistory())
     
 # Close the console
-console.closeConsole()
+domain.closeConsole()
 
 # Stop the domain (nice shutdown)
 domain.stop()
 
-# Save a transcript for human review
-saveLog(console.getHistory())
-
 # Check the output of 'ls'
 
 if not re.search("proc", run["output"]):
index 15b78397cfd7c1eba26cbf6189f31b9c04c434f2..e141a3bd81162c078a2616f86f1166bcf8e0e622 100644 (file)
@@ -17,7 +17,7 @@ domain1 = XmTestDomain("default")
 
 #start it
 try:
-    domain1.start()
+    domain1.start(noConsole=True)
 except DomainError, e:
     if verbose:
         print "Failed to create test domain1 because:"
@@ -30,7 +30,7 @@ domain2 = XmTestDomain("default")
 #start it
 eyecatcher = "Pass"
 try:
-    domain2.start()
+    domain2.start(noConsole=True)
 except DomainError, e:
     eyecatcher = "Fail"
     # Stop the domain1 (nice shutdown)
index 6f7193636bb1046727de3dd302c45296471e67d0..f8bc946bcde592510fd606c35f4f6f4d365b3443 100644 (file)
@@ -23,7 +23,7 @@ config1 = {"memory": 0}
 domain1=XmTestDomain(extraConfig=config1)
 
 try:
-    domain1.start()
+    domain1.start(noConsole=True)
     eyecatcher1 = "Created"
 except DomainError, e:
     eyecatcher1 = "Fail"
@@ -42,7 +42,7 @@ config2 = {"memory": extreme_mem}
 domain2=XmTestDomain(extraConfig=config2)
 
 try:
-    domain2.start()
+    domain2.start(noConsole=True)
     eyecatcher2 = "Created"
 except DomainError, e:
     eyecatcher2 = "Fail"
index d801b8a8b08365241220f8656f9c1f338b4ea90c..ae2f84adb11b782407c84ca89698b5aad297cd62 100644 (file)
@@ -28,7 +28,7 @@ domain_mem64=XmTestDomain(extraConfig=config)
 
 #start it
 try:
-    domain_mem64.start()
+    domain_mem64.start(noConsole=True)
 except DomainError, e:
     if verbose:
         print "Failed to create test domain_mem64 because:"
index a830c7dc8e708ba4e7342964ade1f50ef008794b..0d50006b36798db8bf489eb96827c0cd5c6a6240 100644 (file)
@@ -28,7 +28,7 @@ domain_mem128=XmTestDomain(extraConfig=config)
 
 #start it
 try:
-    domain_mem128.start()
+    domain_mem128.start(noConsole=True)
 except DomainError, e:
     if verbose:
         print "Failed to create test domain_mem128 because:"
index 07d73d8127c8ef6469022ff947206714e30c05dc..c926d62de80a98cd0fcc618910831b7283a078f6 100644 (file)
@@ -28,7 +28,7 @@ domain_mem256=XmTestDomain(extraConfig=config)
 
 #start it
 try:
-    domain_mem256.start()
+    domain_mem256.start(noConsole=True)
 except DomainError, e:
     if verbose:
         print "Failed to create test domain_mem256 because:"
index f17d4502b999929d509699ce59c0dce837d606dc..3f392d218c4dcd85f45e0af4a89b7a4175e86ba0 100644 (file)
@@ -28,7 +28,7 @@ i = 0
 for i in range(0,50):
     domain = XmTestDomain("testdomain")
     try:
-        domain.start()
+        domain.start(noConsole=True)
     except DomainError,e:
         print "Failed: " + e.extra
         NSPerror = check_for_NSP_error(e.extra)
index 7ae74d18a6ec93798be64383c9369179772db482..ad5f297719e9c7a85d894ac42eb09585acda69b0 100644 (file)
@@ -43,15 +43,13 @@ for d in range(0, NUM_DOMS):
                        extraConfig={"memory":MEM_PER_DOM})
 
     try:
-        dom.start()
+        cons = dom.start()
     except DomainError, e:
         if verbose:
             print str(e)
         FAIL("[%i] Failed to create domain" % d)
 
     try:
-        cons = XmConsole(dom.getName())
-        cons.sendInput("foo")
         cons.runCmd("ls")
     except ConsoleError, e:
         FAIL("[%i] Failed to attach console to %s" % (d, dom.getName()))
index 8bffb1b2c6a5559538889c9f6647e7666a30fae3..06b125083f5167e6ecdfb80378d08f71d9876921 100644 (file)
@@ -17,18 +17,12 @@ for i in range(0,DOMS):
     dom = XmTestDomain(extraConfig={"memory" : MEM})
 
     try:
-        dom.start()
+        cons = dom.start()
     except DomainError, e:
         if verbose:
             print str(e)
         FAIL("Failed to start %s" % dom.getName())
 
-    try:
-        cons = XmConsole(dom.getName())
-        cons.sendInput("foo")
-    except ConsoleError, e:
-        FAIL(str(e))
-
     if verbose:
         print "[%i/%i] Started %s" % (i, DOMS, dom.getName())
 
@@ -56,4 +50,3 @@ for d, c in domains:
     if run["return"] != 0:
         FAIL("Domain %s didn't survive!" % d.getName())
 
-        
index 6f86e25f16035e94031f66e510e5bfaef8a94eec..38c8b39f26946d9247b81abe175918c51f4a7d0c 100644 (file)
@@ -18,13 +18,11 @@ for i in range(0,MAX_NICS):
     domain = XmTestDomain(extraConfig=config)
 
     try:
-        domain.start()
+        console = domain.start()
     except DomainError, e:
         FAIL("(%i nics) " % i + str(e))
 
     try:
-        console = XmConsole(domain.getName())
-        console.sendInput("input")
         console.runCmd("ls")
     except ConsoleError, e:
         FAIL("(%i nics) Console didn't respond: probably crashed!" % i)
index ef52ffc48a2b49426d209953ef2966c0cd09dd0d..58eeb2b9b399e0370f7563489628399953d88d55 100644 (file)
@@ -31,20 +31,14 @@ else:
     domain = XenDomain(name=domConfig.getOpt("name"), config=domConfig)
 
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
       FAIL(str(e))
 
 #waitForBoot()
 
-try:
-    console = XmConsole(domain.getName(), historySaveCmds=True)
-except ConsoleError, e:
-    FAIL(str(e))
-
 try:
 #    console.debugMe = True
-    console.sendInput("foo")
     run = console.runCmd("ls")
 
 except ConsoleError, e:
index 2658cf379d3e57646e3afbb9b6ac71cce0440713..faca03336bbe39cb864ced8fcbd554ab3f758db1 100644 (file)
@@ -12,13 +12,11 @@ domain = XmTestDomain(extraConfig={"memory": MEM,
                                    "extra" :"mem=%iM" % MEM})
 
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     FAIL("Unable to start a domain with %i MB" % MEM)
 
 try:
-    console = XmConsole(domain.getName())
-    console.sendInput("input")
     console.runCmd("ls")
 except ConsoleError, e:
     if e.reason == RUNAWAY:
index 589208580c0831100833a15f82342a84fbac57d1..5bbaa6f7041f5cafe542f88defb43019d4275dd6 100644 (file)
@@ -13,13 +13,11 @@ domain = XmTestDomain(extraConfig={"memory": MEM,
                                    "extra" :"mem=%iM" % MEM})
 
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     FAIL("Unable to start a domain with %i MB" % MEM)
 
 try:
-    console = XmConsole(domain.getName())
-    console.sendInput("input")
     console.runCmd("ls")
 except ConsoleError, e:
     if e.reason == RUNAWAY:
index d76f280951542fd71e7c9aaf550ca990a99b0669..3d007b12a4ea1da9c05295f0bae52fbbc1af681f 100644 (file)
@@ -14,29 +14,21 @@ domain = XmTestDomain()
 
 # Start it
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
         print e.extra
     FAIL(str(e))
 
-# Attach a console to it
 try:
-    console = XmConsole(domain.getName(), historySaveCmds=True)
-except ConsoleError, e:
-    FAIL(str(e))
-
-try:
-    # Activate the console
-    console.sendInput("foo")
     # Run 'ls'
     run = console.runCmd("ls")
 except ConsoleError, e:
     FAIL(str(e))
 
 # Close the console
-console.closeConsole()
+domain.closeConsole()
 
 # Check the output of 'ls'
 if not re.search("proc", run["output"]):
index 8c10e2a866cfcca1ce9d039fb7545cdb3457f9e4..655b7a3e724e97f875097b3d86d3b5747b5d7c5d 100644 (file)
@@ -7,8 +7,7 @@
 # Positive Test:
 # Test Description:
 # 1. Create a domain
-# 2. Attach a console to the domain. 
-# 3. Destroy the domain by id
+# 2. Destroy the domain by id
  
 import sys
 import re
@@ -21,7 +20,7 @@ domain = XmTestDomain()
 
 # Start it
 try:
-    domain.start()
+    domain.start(noConsole=True)
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
index 9c5a69771f965d317fca5054b61f1fecd1ca6dd1..83c796aacd2aa460827499d903323c01d4b674dc 100644 (file)
@@ -108,14 +108,11 @@ def runTests(tests):
         # Create a domain
 
         try:
-            domain.start()
+            console = domain.start()
         except DomainError, e:
             FAIL(str(e))
 
-        # Attach a console and make sure it's live
         try:
-            console = XmConsole(domain.getName())
-            console.sendInput("foo")
             console.runCmd("ls")
         except ConsoleError, e:
             FAIL(str(e))
index 0f567094aa54ef60bbde71191dd2f2d909b03722..ec0e1cfddc3af99e57add28dcd7c772e5b4650cc 100644 (file)
@@ -12,23 +12,17 @@ from XmTestLib import *
 domain = XmTestDomain()
 
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
         print e.extra
     FAIL(str(e))
 
-try:
-    console = XmConsole(domain.getName())
-except ConsoleError, e:
-    FAIL(str(e))
-
-
 status, output = traceCommand("xm list %s" % domain.getName())
 
 if status != 0:
     FAIL("`xm list %s' failed with invalid status %i != 0" % (domain.getName(), status))
 
-console.closeConsole()
+domain.closeConsole()
 domain.stop()
index 376ec8280921ef7495b5193e16155ffbe4a37989..1eb81b5c2f6b4bd43ef5a35fa590e0f74c2f96bd 100644 (file)
@@ -28,17 +28,14 @@ domain = XmTestDomain()
 
 # Start it
 try:
-    domain.start() 
+    console = domain.start() 
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
         print e.extra
     FAIL(str(e))
 
-# Attach a console to it
 try:
-    console = XmConsole(domain.getName()) 
-    console.sendInput("input") 
     # Make sure it's up an running before we continue
     console.runCmd("ls")
 except ConsoleError, e:
@@ -96,7 +93,7 @@ if domUmem != newmem:
 
 # quiesce everything
 # Close the console
-console.closeConsole() 
+domain.closeConsole() 
 
 # Stop the domain (nice shutdown)
 domain.stop()
index bb78c90cee157aeb80c5e7059200730a116eacdc..e8e2b350cde27d503cf5833e58c5815907ca7262 100644 (file)
@@ -14,7 +14,7 @@ if ENABLE_HVM_SUPPORT:
 domain = XmTestDomain()
 
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print "Failed to start domain:"
index fd4c027949ecd6aa714d1672cf567cd46e7b5660..6bce662b6d6bc521d2c26a247314c19ba8e0718e 100644 (file)
@@ -11,7 +11,7 @@ if ENABLE_HVM_SUPPORT:
 domain = XmTestDomain()
 
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print "Failed to start domain: "
@@ -19,8 +19,6 @@ except DomainError, e:
     FAIL(str(e))
 
 try:
-    console = XmConsole(domain.getName())
-    console.sendInput("input")
     # Make sure it's alive before we proceed
     console.runCmd("ls")
 except ConsoleError, e:
index a172efef6172735e803dc34577e7227cb48b43bb..e71bf6935d1e8970918d39caa2c7b6a4f9dc8057 100644 (file)
@@ -25,29 +25,21 @@ domain = XmTestDomain()
 
 # Start it
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
         print e.extra
     FAIL(str(e))
 
-# Attach a console to it
-try:
-    console = XmConsole(domain.getName(), historySaveCmds=True)
-except ConsoleError, e:
-    FAIL(str(e))
-
 try:
-    # Activate the console
-    console.sendInput("foo")
     # Set a variable to check on the other side
     run = console.runCmd("foo=bar")
 except ConsoleError, e:
     FAIL(str(e))
 
 # Close the console
-console.closeConsole()
+domain.closeConsole()
 
 old_domid = domid(domain.getName())
 
@@ -68,11 +60,12 @@ if (old_domid == new_domid):
 
 # Attach a console to it
 try:
-    console = XmConsole(domain.getName(), historySaveCmds=True)
+    console = domain.getConsole()
     console.debugMe = True
 except ConsoleError, e:
     pass
 
+console.setHistorySaveCmds(value=True)
 console.sendInput("ls")
 
 # Run 'ls'
@@ -86,7 +79,7 @@ if not re.search("bar", run["output"]):
     FAIL("Migrated domain has been reset")
 
 # Close the console
-console.closeConsole()
+domain.closeConsole()
 
 # Stop the domain (nice shutdown)
 domain.stop()
index 8d4b635a54ff8cd1015d20dd39570af6098049f4..f8e7f1a7489e24c91ded37395c87ecbf0a54fb0e 100644 (file)
@@ -15,22 +15,14 @@ if ENABLE_HVM_SUPPORT:
 domain = XmTestDomain()
 
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
         print e.extra
     FAIL(str(e))
 
-# Attach a console to it
 try:
-    console = XmConsole(domain.getName(), historySaveCmds=True)
-except ConsoleError, e:
-    FAIL(str(e))
-
-try:
-    # Activate the console
-    console.sendInput("input")
     # Run 'ls'
     run = console.runCmd("ls")
 except ConsoleError, e:
@@ -45,7 +37,7 @@ if status:
 
 ##
 # Close the console
-console.closeConsole()
+domain.closeConsole()
 
 # Stop the domain (nice shutdown)
 domain.stop()
index 5b50714b9dfad732418ff512d1e97be5cd23048d..c985957dd91854c47145bc701d660abb36602665 100644 (file)
@@ -17,22 +17,14 @@ if ENABLE_HVM_SUPPORT:
 domain = XmTestDomain()
 
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
         print e.extra
     FAIL(str(e))
 
-# Attach a console to it
 try:
-    console = XmConsole(domain.getName(), historySaveCmds=True)
-except ConsoleError, e:
-    FAIL(str(e))
-
-try:
-    # Activate the console
-    console.sendInput("input")
     # Run 'ls'
     run = console.runCmd("ls")
 except ConsoleError, e:
@@ -51,7 +43,7 @@ if status:
 
 
 # Close the console
-console.closeConsole()
+domain.closeConsole()
 
 # Stop the domain (nice shutdown)
 domain.stop()
index 76da5891a3ec7f55951886ea766bb6495719293e..b3e49e4c0e5da238e47851b95326be27025e071d 100644 (file)
@@ -17,25 +17,16 @@ if ENABLE_HVM_SUPPORT:
 domain = XmTestDomain()
 
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
         print e.extra
     FAIL(str(e))
 
-# Attach a console to it
-try:
-    console = XmConsole(domain.getName(), historySaveCmds=True)
-    # network-detach is crashing, so we enable console debugging
-    # for now, so that reports include the oops
-    console.debugMe = True
-except ConsoleError, e:
-    FAIL(str(e))
+console.debugMe = True
 
 try:
-    # Activate the console
-    console.sendInput("input")
     # Run 'ls'
     run = console.runCmd("ls")
 except ConsoleError, e:
@@ -54,7 +45,7 @@ for i in range(10):
         FAIL(msg)
 
 # Close the console
-console.closeConsole()
+domain.closeConsole()
 
 # Stop the domain (nice shutdown)
 domain.stop()
index 3a673cf8cbdf57603a45ab8d9ebc1316246ff226..43bd380ec044673d309cb9f7654caf959fc14dde 100644 (file)
@@ -35,24 +35,14 @@ else:
 
 domain = XmTestDomain(extraConfig=config)
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
         print e.extra
     FAIL(str(e))
 
-
-# Attach a console
-try:
-    console = XmConsole(domain.getName(), historySaveCmds=True)
-except ConsoleError, e:
-    FAIL(str(e))
-
 try:
-    # Activate the console
-    console.sendInput("bhs")
-
     # Bring up the "lo" interface.
     console.runCmd("ifconfig lo 127.0.0.1")
 
index 2ca7b8dce037866b41772e57ec7e3ebd12ee8e46..3a8f07e37af7fec2437cf78145de1b1b844c16ac 100644 (file)
@@ -40,24 +40,14 @@ else:
 
 domain = XmTestDomain(extraConfig=config)
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
         print e.extra
     FAIL(str(e))
 
-
-# Attach a console
-try:
-    console = XmConsole(domain.getName(), historySaveCmds=True)
-except ConsoleError, e:
-    FAIL(str(e))
-
 try:
-    # Activate the console
-    console.sendInput("bhs")
-
     # Bring up the "lo" interface.
     console.runCmd("ifconfig lo 127.0.0.1")
 
index 35e51c4b5d4c4188b7cb67d0ffb536d9be42c040..2ccd1d3814e18425fb75a6515b9d41d009a5dfea 100644 (file)
@@ -39,24 +39,14 @@ else:
 
 domain = XmTestDomain(extraConfig=config)
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
         print e.extra
     FAIL(str(e))
 
-
-# Attach a console
-try:
-    console = XmConsole(domain.getName(), historySaveCmds=True)
-except ConsoleError, e:
-    FAIL(str(e))
-
 try:
-    # Activate the console
-    console.sendInput("bhs")
-
     # Bring up the "lo" interface.
     console.runCmd("ifconfig lo 127.0.0.1")
 
index 7e87c43959cb83d3e2dbc15c0df0227af4b2ad58..7ab14c483376074dba38a3a33e4821d363c37bec 100644 (file)
@@ -40,22 +40,13 @@ else:
 
 domain = XmTestDomain(extraConfig=config)
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
         print e.extra
     FAIL(str(e))
 
-
-# Attach a console
-try:
-    console = XmConsole(domain.getName(), historySaveCmds=True)
-    # Activate the console
-    console.sendInput("bhs")
-except ConsoleError, e:
-    FAIL(str(e))
-
 try:
     # Add a suitable dom0 IP address 
     dom0ip = Net.ip("dom0", "eth0", todomname=domain.getName(), toeth="eth0", bridge=brg)
index 7bd9c4a86bd24e793534f866dbc3bb0922a85e27..1a14f537e4b9a71218dc0987235e49b1395b9530 100644 (file)
@@ -40,22 +40,13 @@ else:
 
 domain = XmTestDomain(extraConfig=config)
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
         print e.extra
     FAIL(str(e))
 
-
-# Attach a console
-try:
-    console = XmConsole(domain.getName(), historySaveCmds=True)
-    # Activate the console
-    console.sendInput("bhs")
-except ConsoleError, e:
-    FAIL(str(e))
-
 try:
     # Add a suitable dom0 IP address 
     dom0ip = Net.ip("dom0", "eth0", todomname=domain.getName(), toeth="eth0", bridge=brg)
index 05524989d9dde3846aa9ee4d6b0e69b5cc094c9f..27d1116fe696828309e3160caf64655de13aa081 100644 (file)
@@ -40,22 +40,13 @@ else:
 
 domain = XmTestDomain(extraConfig=config)
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
         print e.extra
     FAIL(str(e))
 
-
-# Attach a console
-try:
-    console = XmConsole(domain.getName(), historySaveCmds=True)
-    # Activate the console
-    console.sendInput("bhs")
-except ConsoleError, e:
-    FAIL(str(e))
-
 try:
     # Add a suitable dom0 IP address 
     dom0ip = Net.ip("dom0", "eth0", todomname=domain.getName(), toeth="eth0", bridge=brg)
index b35aea9dae4779adb665821c882fdf863f7da47b..c5b9d6099f1f6ca92b381410d1e1f1b184b0b620 100644 (file)
@@ -25,19 +25,12 @@ def netDomain(ip):
 
     dom = XmTestDomain(extraConfig=config)
     try:
-        dom.start()
+        console = dom.start()
     except DomainError, e:
         if verbose:
             print "Failed to create test domain because:"
             print e.extra
         FAIL(str(e))
-    try:
-        # Attach a console
-        console = XmConsole(dom.getName(), historySaveCmds=True)
-        # Activate the console
-        console.sendInput("bhs")
-    except ConsoleError, e:
-        FAIL(str(e))
     return console
     
 rc = 0
index 5a23fab164eb736500357ac46dd5e94521e1b09c..e4001ea7b03660c948d8c993dab62b2e4e52d4a0 100644 (file)
@@ -25,19 +25,12 @@ def netDomain(ip):
 
     dom = XmTestDomain(extraConfig=config)
     try:
-        dom.start()
+        console = dom.start()
     except DomainError, e:
         if verbose:
             print "Failed to create test domain because:"
             print e.extra
         FAIL(str(e))
-    try:
-        # Attach a console
-        console = XmConsole(dom.getName(), historySaveCmds=True)
-        # Activate the console
-        console.sendInput("bhs")
-    except ConsoleError, e:
-        FAIL(str(e))
     return console
     
 rc = 0
index 4221206f5fbad115b91f2b3fe32ebec7fd0adb8f..18d7f12c8d774c64da8d81e231de695213c9c03a 100644 (file)
@@ -25,19 +25,12 @@ def netDomain(ip):
 
     dom = XmTestDomain(extraConfig=config)
     try:
-        dom.start()
+        console = dom.start()
     except DomainError, e:
         if verbose:
             print "Failed to create test domain because:"
             print e.extra
         FAIL(str(e))
-    try:
-        # Attach a console
-        console = XmConsole(dom.getName(), historySaveCmds=True)
-        # Activate the console
-        console.sendInput("bhs")
-    except ConsoleError, e:
-        FAIL(str(e))
     return console
     
 rc = 0
index 58306ae1a8a307926520373694ffaa321216404e..c104cd979040bc941de4317eaad90960cf75ef08 100644 (file)
@@ -20,29 +20,21 @@ domain = XmTestDomain()
 
 # Start it
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
         print e.extra
     FAIL(str(e))
 
-# Attach a console to it
 try:
-    console = XmConsole(domain.getName(), historySaveCmds=True)
-except ConsoleError, e:
-    FAIL(str(e))
-
-try:
-    # Activate the console
-    console.sendInput("foo")
     # Make sure a command succeeds
     run = console.runCmd("ls")
 except ConsoleError, e:
     FAIL(str(e))
 
 # Close the console
-console.closeConsole()
+domain.closeConsole()
 
 # Pause the domain
 status, output = traceCommand("xm pause %s" % domain.getName())
@@ -51,7 +43,8 @@ if status != 0:
 
 # Try to attach a console to it
 try:
-    console = XmConsole(domain.getName(), historySaveCmds=True)
+    console = domain.getConsole()
+    console.setHistorySaveCmds(value=True)
     run = console.runCmd("ls")
     #If we get here, console attached to paused domain (unexpected)
     FAIL("console attached to supposedly paused domain")
@@ -59,7 +52,7 @@ except ConsoleError, e:
     pass
 
 # Close the console
-console.closeConsole()
+domain.closeConsole()
 
 status, output = traceCommand("xm unpause %s" % domain.getName())
 if status != 0:
index 18eda676411cbe0a3420c66b13cea22fdd356dde..82173f14e62fa11e19e6e4a0cbcd919af2d00e96 100644 (file)
@@ -11,7 +11,7 @@ from XmTestLib import *
 domain = XmTestDomain()
 
 try:
-    domain.start()
+    domain.start(noConsole=True)
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
index e33c93a28fe462d8a584ab5343ba6b2e7e51cbf6..df006c423678052ff5d47efe9c990ba3533d1f15 100644 (file)
@@ -11,19 +11,14 @@ from XmTestLib import *
 domain = XmTestDomain()
 
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
         print e.extra
     FAIL(str(e))
 
-try:
-    console = XmConsole(domain.getName())
-except ConsoleError, e:
-    FAIL(str(e))
-
-console.closeConsole()
+domain.closeConsole()
 
 status, output = traceCommand("xm reboot %s" % domain.getName())
 
@@ -33,7 +28,7 @@ if status != 0:
 time.sleep(15)
 
 try:
-    console = XmConsole(domain.getName())
+    console = domain.getConsole()
 except ConsoleError, e:
     FAIL(str(e))
 
@@ -43,7 +38,7 @@ try:
 except ConsoleError, e:
     FAIL(str(e))
 
-console.closeConsole()
+domain.closeConsole()
 
 domain.destroy()
 
index b0a23bb4a5d03880345402ab73c4206827be362b..fc60ac2f18f15832ec773fc6dcb5f009f568c803 100644 (file)
@@ -11,7 +11,7 @@ from XmTestLib import *
 domain = XmTestDomain()
 
 try:
-    domain.start()
+    domain.start(noConsole=True)
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
index 9ea1ca4c53c5d02b6fc0daf6e41e8fe22e01b4db..4a61c2af01cfe1c9e0d416b691d104c9b067d805 100644 (file)
@@ -18,7 +18,7 @@ if ENABLE_HVM_SUPPORT:
 domain = XmTestDomain()
 
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
@@ -27,13 +27,11 @@ except DomainError, e:
 
 # Make sure the domain isn't DOA
 try:
-    console = XmConsole(domain.getName())
-    console.sendInput("input")
     console.runCmd("foo=bar")
 except ConsoleError, e:
     FAIL(str(e))
 
-console.closeConsole()
+domain.closeConsole()
 
 # Save it out
 try:
@@ -67,7 +65,7 @@ if not isDomainRunning(domain.getName()):
 
 # Make sure it's alive
 try:
-    newConsole = XmConsole(domain.getName())
+    newConsole = domain.getConsole()
     # Enable debug dumping because this generates a Oops on x86_64
     newConsole.debugMe = True
     newConsole.sendInput("ls")
@@ -77,7 +75,7 @@ try:
 except ConsoleError, e:
     FAIL("Restored domain is dead (%s)" % str(e))
 
-newConsole.closeConsole()
+domain.closeConsole()
 
 # This only works because the domain
 # still has the same name
index b3dfe7312113b67421bcfe24917e4b02aba0c3c6..63b716da629edbff3f082393beaea8e796676cb2 100644 (file)
@@ -23,14 +23,11 @@ if s != 0:
     FAIL("Unable to mke2fs /dev/ram1 in dom0")
 
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     FAIL(str(e))
 
 try:
-    console = XmConsole(domain.getName())
-    console.sendInput("foo")
-
     run = console.runCmd("mkdir /mnt/a /mnt/b")
     if run["return"] != 0:
         FAIL("Unable to mkdir /mnt/a /mnt/b")
@@ -67,7 +64,7 @@ try:
 except ConsoleError, e:
     FAIL(str(e))
 
-console.closeConsole()
+domain.closeConsole()
 
 try:
     s, o = traceCommand("xm save %s /tmp/test.state" % domain.getName(),
@@ -91,7 +88,7 @@ if s != 0:
     FAIL("xm restore exited with %i != 0" % s)
 
 try:
-    console = XmConsole(domain.getName())
+    console = domain.getConsole()
     # Enable debug dumping, as this causes an Oops on x86_64
     console.debugMe = True
 
index b5a87ad91debd1762da574bd3f831a39e4590518..34270faa0934a2cf8a4fac1e813740aba844a4c4 100644 (file)
@@ -13,20 +13,14 @@ if ENABLE_HVM_SUPPORT:
 domain = XmTestDomain()
 
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
         print e.extra
     FAIL(str(e))
 
-# Make sure the domain isn't DOA
-try:
-    console = XmConsole(domain.getName())
-except ConsoleError, e:
-    FAIL(str(e))
-
-console.closeConsole()
+domain.closeConsole()
 
 # Save it out
 try:
index 2612f74b1ba045c628984d525e1064d8392b7cfc..b8b99cd0b743661f5b79604019b372c483f7a16a 100644 (file)
@@ -16,20 +16,14 @@ if ENABLE_HVM_SUPPORT:
 domain = XmTestDomain()
 
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
         print e.extra
     FAIL(str(e))
 
-# Make sure the domain isn't DOA
-try:
-    console = XmConsole(domain.getName())
-except ConsoleError, e:
-    FAIL(str(e))
-
-console.closeConsole()
+domain.closeConsole()
 
 # Save it out
 status, output = traceCommand("xm save %s /NOWHERE/test.state" % domain.getName())
index 6b6b95c97a9cfd269be41b60f08105aae84e6edc..73392203cc60e92e3a20c687cae4a462de82783a 100644 (file)
@@ -14,7 +14,7 @@ def get_sedf_params(domain):
 domain = XmTestDomain(extraConfig = {"sched":"sedf"})
 
 try:
-    domain.start()
+    domain.start(noConsole=True)
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
index 91c06722430442620ad264815b0033b527d28723..73bf9f2963663c010853c614640acc530f6a0dbe 100644 (file)
@@ -16,7 +16,7 @@ def get_sedf_params(domain):
 domain = XmTestDomain(extraConfig = {"sched":"sedf"})
 
 try:
-    domain.start()
+    domain.start(noConsole=True)
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
index 613a46a7b8da181866f242d4da40d8c944f5224b..f9b07a4363227b3aa0163a4354e99e14aa850b0b 100644 (file)
@@ -16,7 +16,7 @@ def get_sedf_params(domain):
 domain = XmTestDomain(extraConfig = {"sched":"sedf"})
 
 try:
-    domain.start()
+    domain.start(noConsole=True)
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
index 8144021a1d59bb82edb4b04d43cebb1c3d2b0888..0d9d6d48b4e6b13f68752a846bdd1a7b9ed876be 100644 (file)
@@ -14,7 +14,7 @@ def get_sedf_params(domain):
 domain = XmTestDomain(extraConfig = {"sched":"sedf"})
 
 try:
-    domain.start()
+    domain.start(noConsole=True)
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
index 4ca28075eac9f3523bdcddb4e12838df87d47e74..702d64bedc2def548b9586705ef254da125b935c 100644 (file)
@@ -14,7 +14,7 @@ def get_sedf_params(domain):
 domain = XmTestDomain(extraConfig = {"sched":"sedf"})
 
 try:
-    domain.start()
+    domain.start(noConsole=True)
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
index 202389fe1b900620a9987c4534a82e9ed3643786..e0a79741067741dd74b8f49d29bcf9643f4eef43 100644 (file)
@@ -14,7 +14,7 @@ def get_sedf_params(domain):
 domain = XmTestDomain(extraConfig = {"sched":"sedf"})
 
 try:
-    domain.start()
+    domain.start(noConsole=True)
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
index e1a1531f7c63d11c66f41d87884d780e3934ff22..bfedf65b101825583a42d3c35087e8b030a03a39 100644 (file)
@@ -19,29 +19,21 @@ domain = XmTestDomain()
 
 # Start it
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
         print e.extra
     FAIL(str(e))
 
-# Attach a console to it
 try:
-    console = XmConsole(domain.getName(), historySaveCmds=True)
-except ConsoleError, e:
-    FAIL(str(e))
-
-try:
-    # Activate the console
-    console.sendInput("foo")
     # Make sure a command succeeds
     run = console.runCmd("ls /bin")
 except ConsoleError, e:
     FAIL(str(e))
 
 # Close the console
-console.closeConsole()
+domain.closeConsole()
 
 # Stop the domain (nice shutdown)
 status, output = traceCommand("xm shutdown %s" % domain.getName())
index 8ec2a5b3c299cc08cc06eb24a358d001b752cd84..6a70ae2ce39c588347488094b1b516c243b2ef61 100644 (file)
@@ -20,7 +20,7 @@ domain = XmTestDomain()
 
 # Start it
 try:
-    domain.start()
+    domain.start(noConsole=True)
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
index 3aea592a0ec7c1de19a0a6b8d154709109ce399c..e6d73fbf09824d1c4631f210dc5631405522fa30 100644 (file)
@@ -17,20 +17,13 @@ domain = XmTestDomain()
 
 # Start it
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
         print e.extra
     FAIL(str(e))
 
-# Attach a console to it
-try:
-    console = XmConsole(domain.getName(), historySaveCmds=True)
-except ConsoleError, e:
-    FAIL(str(e))
-
-
 status, output = traceCommand("xm sysrq %s s" % domain.getName())
 
 if status != 0:
@@ -40,15 +33,13 @@ if status != 0:
 
 # Run 'ls'
 try:
-    # Activate the console
-    console.sendInput("foo")
     # Check the dmesg output on the domU
     run = console.runCmd("dmesg | grep Emerg\n")
 except ConsoleError, e:
     FAIL(str(e))
 
 # Close the console
-console.closeConsole()
+domain.closeConsole()
 
 # Stop the domain (nice shutdown)
 domain.stop()
index 71cc9f1fb42933b613276bd25c2dfd4bd497d9c4..d314b40ccfabe5f6e97f95f8ac4b7637946ee17b 100644 (file)
@@ -13,7 +13,7 @@ if ENABLE_HVM_SUPPORT:
 domain = XmTestDomain()
 
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print "Failed to create domain:"
@@ -27,12 +27,6 @@ if status != 0:
 # Wait for the reboot to finish
 time.sleep(20)
 
-try:
-    console = XmConsole(domain.getName())
-    console.sendInput("input")
-except ConsoleError, e:
-    FAIL(str(e))
-
 status, output = traceCommand("xm sysrq %s s" % domain.getName())
 if status != 0:
     FAIL("sysrq failed with %i != 0" % status)
index d459c6abd116610007f39075137c53ea82f0c87f..7bd2f1f20ea476cf56ea62392d63c5dcf73a5719 100644 (file)
@@ -22,29 +22,21 @@ domain = XmTestDomain()
 
 # Start it
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
         print e.extra
     FAIL(str(e))
 
-# Attach a console to it
 try:
-    console = XmConsole(domain.getName(), historySaveCmds=True)
-except ConsoleError, e:
-    FAIL(str(e))
-
-try:
-    # Activate the console
-    console.sendInput("foo")
     # Make sure a command succeeds
     run = console.runCmd("ls")
 except ConsoleError, e:
     FAIL(str(e))
 
 # Close the console
-console.closeConsole()
+domain.closeConsole()
 
 seed(time.time())
 
@@ -69,13 +61,13 @@ if status != 0:
 
 # Are we still alive after all that?
 try:
-    console = XmConsole(domain.getName(), historySaveCmds=True)
+    console = domain.getConsole()
     run = console.runCmd("ls")
 except ConsoleError, e:
     FAIL(str(e))
 
 # Close the console
-console.closeConsole()
+domain.closeConsole()
 
 if run["return"] != 0:
     FAIL("console failed to attach to supposedly unpaused domain")
index ac1eefa1b8bcd325a2119aa14a5a0f7ab3a9c080..08691255cf700184fb3172d6d34c28ece7e5b9de 100644 (file)
@@ -42,7 +42,7 @@ if smpConcurrencyLevel() <= 1:
 domain = XmTestDomain(extraConfig={"vcpus":2})
 
 try:
-    domain.start()
+    domain.start(noConsole=True)
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
index df6f7deb6d58907681c9bf2e9f2925fb9e2e52a5..f254401448242aba32f39e8a25acb82d19d0ba43 100644 (file)
@@ -20,7 +20,7 @@ if smpConcurrencyLevel() <= 1:
 domain = XmTestDomain()
 
 try:
-    domain.start()
+    domain.start(noConsole=True)
 except DomainError, e:
     if verbose:
         print "Failed to create test domain because:"
index f5c428e1cab2efbcc1d7231c0df0dd3386fe20b8..a427bf2fdebe409dc6c5b66849d229bd5ebccf0a 100644 (file)
@@ -16,7 +16,7 @@ config = {"vtpm":"instance=1,backend=0"}
 domain = XmTestDomain(extraConfig=config)
 
 try:
-    domain.start()
+    domain.start(noConsole=True)
 except DomainError, e:
     if verbose:
         print e.extra
index feeb6cb42a206540617385ade4695331ea15f512..d554dfb717646e8df59560a3a8436c49b8e22e00 100644 (file)
@@ -16,7 +16,7 @@ config = {"vtpm":"instance=1,backend=0"}
 domain = XmTestDomain(extraConfig=config)
 
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print e.extra
@@ -25,12 +25,6 @@ except DomainError, e:
 
 domName = domain.getName()
 
-try:
-    console = XmConsole(domain.getName())
-except ConsoleError, e:
-    vtpm_cleanup(domName)
-    FAIL(str(e))
-
 try:
     console.sendInput("input")
 except ConsoleError, e:
@@ -49,7 +43,7 @@ if re.search("No such file",run["output"]):
     vtpm_cleanup(domName)
     FAIL("TPM frontend support not compiled into (domU?) kernel")
 
-console.closeConsole()
+domain.closeConsole()
 
 domain.stop()
 
index 7e291763af68f067022bb550f9ed0a894d8d7a2a..27cd4eaa7162476fb73d1036d5f857a5c601a348 100644 (file)
@@ -15,9 +15,10 @@ import os.path
 
 config = {"vtpm":"instance=1,backend=0"}
 domain = XmTestDomain(extraConfig=config)
+consoleHistory = ""
 
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print e.extra
@@ -26,12 +27,6 @@ except DomainError, e:
 
 domName = domain.getName()
 
-try:
-    console = XmConsole(domain.getName())
-except ConsoleError, e:
-    vtpm_cleanup(domName)
-    FAIL(str(e))
-
 try:
     console.sendInput("input")
 except ConsoleError, e:
@@ -50,19 +45,21 @@ if re.search("No such file",run["output"]):
     vtpm_cleanup(domName)
     FAIL("TPM frontend support not compiled into (domU?) kernel")
 
-console.closeConsole()
+consoleHistory = console.getHistory()
+domain.closeConsole()
 
 try:
     status, ouptut = traceCommand("xm save %s %s.save" %
                                   (domName, domName),
                                   timeout=30)
+
 except TimeoutError, e:
-    saveLog(console.getHistory())
+    saveLog(consoleHistory)
     vtpm_cleanup(domName)
     FAIL(str(e))
 
 if status != 0:
-    saveLog(console.getHistory())
+    saveLog(consoleHistory)
     vtpm_cleanup(domName)
     FAIL("xm save did not succeed")
 
@@ -72,19 +69,19 @@ try:
                                   timeout=30)
 except TimeoutError, e:
     os.remove("%s.save" % domName)
-    saveLog(console.getHistory())
+    saveLog(consoleHistory)
     vtpm_cleanup(domName)
     FAIL(str(e))
 
 os.remove("%s.save" % domName)
 
 if status != 0:
-    saveLog(console.getHistory())
+    saveLog(consoleHistory)
     vtpm_cleanup(domName)
     FAIL("xm restore did not succeed")
 
 try:
-    console = XmConsole(domain.getName())
+    console = domain.getConsole()
 except ConsoleError, e:
     vtpm_cleanup(domName)
     FAIL(str(e))
@@ -96,7 +93,7 @@ except ConsoleError, e:
     vtpm_cleanup(domName)
     FAIL(str(e))
 
-console.closeConsole()
+domain.closeConsole()
 
 domain.stop()
 
index 33ef06bf307e9926bc56031b57e72791264f6be1..2f68d38dd5cd43931a997da787af13729421e071 100644 (file)
@@ -15,9 +15,10 @@ import os.path
 
 config = {"vtpm":"instance=1,backend=0"}
 domain = XmTestDomain(extraConfig=config)
+consoleHistory = ""
 
 try:
-    domain.start()
+    console = domain.start()
 except DomainError, e:
     if verbose:
         print e.extra
@@ -26,12 +27,6 @@ except DomainError, e:
 
 domName = domain.getName()
 
-try:
-    console = XmConsole(domain.getName())
-except ConsoleError, e:
-    vtpm_cleanup(domName)
-    FAIL(str(e))
-
 try:
     console.sendInput("input")
 except ConsoleError, e:
@@ -50,7 +45,8 @@ if re.search("No such file",run["output"]):
     vtpm_cleanup(domName)
     FAIL("TPM frontend support not compiled into (domU?) kernel")
 
-console.closeConsole()
+consoleHistory = console.getHistory()
+domain.closeConsole()
 
 old_domid = domid(domName)
 
@@ -59,12 +55,12 @@ try:
                                   domName,
                                   timeout=90)
 except TimeoutError, e:
-    saveLog(console.getHistory())
+    saveLog(consoleHistory)
     vtpm_cleanup(domName)
     FAIL(str(e))
 
 if status != 0:
-    saveLog(console.getHistory())
+    saveLog(consoleHistory)
     vtpm_cleanup(domName)
     FAIL("xm migrate did not succeed. External device migration activated?")
 
@@ -77,7 +73,7 @@ if (old_domid == new_domid):
     FAIL("xm migrate failed, domain id is still %s" % old_domid)
 
 try:
-    console = XmConsole(domain.getName())
+    console = domain.getConsole()
 except ConsoleError, e:
     vtpm_cleanup(domName)
     FAIL(str(e))
@@ -89,7 +85,7 @@ except ConsoleError, e:
     vtpm_cleanup(domName)
     FAIL(str(e))
 
-console.closeConsole()
+domain.closeConsole()
 
 domain.stop()